local mappings = {}

mappings.leader = {
	b = {
		name = "Buffer line",
		l = { "<cmd>BufferLineCycleNext<cr>", "Next buffer" },
		h = { "<cmd>BufferLineCyclePrev<cr>", "Previous buffer" },
		L = { "<cmd>BufferLineMoveNext<cr>", "Move buffer to right" },
		H = { "<cmd>BufferLineMovePrev<cr>", "Move buffer to left" },
		c = {
			name = "close",
			l = { "<cmd>BufferLineCloseRight<cr>", "Close the buffer on right" },
			h = { "<cmd>BufferLineCloseLeft<cr>", "Close the buffer on left" },
			p = { "<cmd>BufferLinePickClose<cr>", "Pick a specific buffer to close" },
		},
		s = {
			name = "Sort buffers",
			e = { "<cmd>BufferLineSortByExtension<cr>", "Sort buffers by Extension" },
			d = { "<cmd>BufferLineSortByDirectory<cr>", "Sort buffers by Directory" },
			r = { "<cmd>BufferLineSortByRelativeDirectory<cr>", "Sort buffers by relative Directory" },
			i = {
				'<cmd>lua require"bufferline".sort_buffers_by(function (buf_a, buf_b) return buf_a.id < buf_b.id end)<cr>',
				"Sort buffers by buffer id",
			},
		},
		["1"] = { "<cmd>BufferLineGoToBuffer 1<cr>", "Go to buffer 1" },
		["2"] = { "<cmd>BufferLineGoToBuffer 2<cr>", "Go to buffer 2" },
		["3"] = { "<cmd>BufferLineGoToBuffer 3<cr>", "Go to buffer 3" },
		["4"] = { "<cmd>BufferLineGoToBuffer 4<cr>", "Go to buffer 4" },
		["5"] = { "<cmd>BufferLineGoToBuffer 5<cr>", "Go to buffer 5" },
		["6"] = { "<cmd>BufferLineGoToBuffer 6<cr>", "Go to buffer 6" },
		["7"] = { "<cmd>BufferLineGoToBuffer 7<cr>", "Go to buffer 7" },
		["8"] = { "<cmd>BufferLineGoToBuffer 8<cr>", "Go to buffer 8" },
		["9"] = { "<cmd>BufferLineGoToBuffer 9<cr>", "Go to buffer 9" },
	},

	d = {
		name = "Debug adapter",
		c = { "<cmd>lua require('dap').continue()<cr>", "Continue" },
		d = { "<cmd>lua require('dap').terminate() require('dapui').close()", "End the process" },
		b = {
			name = "Breakpoints",
			t = { "<cmd>lua require('dap').toggle_breakpoint()<cr>", "Toggle breakpoint" },
			c = {
				"<cmd>lua require('dap').set_breakpoint(vim.fn.input('Breakpoint condition: '))<cr>",
				"Set breakpoint with condition",
			},
			l = { "<cmd>lua require('dap').list_breakpoints()<cr>", "List breakpoints" },
		},
		r = {
			name = "Run",
			c = { "<cmd>lua require('dap').run_to_cursor()<cr>", "Run to cursor" },
			l = { "<cmd>lua require('dap').run_last()<cr>", "Run to last??" },
		},
		s = { "<cmd>lua require('dap').run_last()<cr>", "Step over" },
		i = { "<cmd>lua require('dap').step_into()<cr>", "Step into" },
		o = { "<cmd>lua require('dap').step_out()<cr>", "Step out" },
		l = { "<cmd>lua require('dap').repl.open()<cr>", "Open debuger???" },
	},

	f = {
		name = "File",
		t = { "<cmd>NvimTreeToggle<cr>", "Toggle Nvim Tree" },
		r = { "<cmd>NvimTreeRefresh<cr>", "Refresh Nvim Tree" },
		f = { "<cmd>NvimTreeFindFile<cr>", "Find File" },

		b = { "<cmd>Telescope file_browser<cr>", "Telescope's file browser" },
		-- In alpha
		F = { "<cmd>Telescope find_files<cr>", "Find Files using telescope" },
		g = { "<cmd>Telescope git_files<cr>", "Telescope git files" },
		-- In alpha
		l = { '<cmd>lua require("telescope").extensions.frecency.frecency{}<cr>', "File frencency" },
		-- In alpha
		n = { "<cmd>enew<cr>", "Create and start editing the new file" },
		-- In alpha
		o = { "<cmd>Telescope oldfiles<cr>", "File hestory" },
		-- In alpha
		p = { '<cmd>lua require("telescope").extensions.project.project{}<cr>', "Search File in Project" },
		-- In alpha
		w = { "<cmd>Telescope live_grep<cr>", "Search Word in project" },
		-- z = { '<cmd>Telescope zoxide list', 'Unknown'},
	},

	h = {
		name = "Hop",
		w = { "<cmd>HopWord<cr>", "Hop to a word" },
		l = { "<cmd>HopLine<cr>", "Hop to a line" },
		c = { "<cmd>HopChar1<cr>", "Hop to one char" },
		C = { "<cmd>HopChar2<cr>", "Hop to two char" },
		p = { "<cmd>HopPattern<cr>", "Hop to a searching pattern" },
	},

	l = {
		name = "Language",
		a = { "<cmd>Lspsaga code_action<cr>", "Code actions" },
		d = { "<cmd>Lspsaga preview_definition<cr>", "Preview definition in pop up window" },
		h = { "<cmd>Lspsaga signature_help<cr>",
		"Show help of current signature" },
		r = { "<cmd>Lspsaga rename<cr>", "Rename" },
	},

	-- s = {
	-- 	name = "Set",
	-- 	c = { "<cmd>Telescope colorscheme<cr>", "Set colorscheme" },
	-- },

	t = {
		name = "Trouble",
		o = { "<cmd>Trouble<cr>", "Open Trouble" },
		c = { "<cmd>TroubleClose<cr>", "Close Trouble" },
		r = { "<cmd>TroubleRefresh<cr>", "Refresh Trouble" },
		d = { "<cmd>TroubleToggle document_diagnostics<cr>", "Toggle Trouble in document_diagnostics mode" },
		w = { "<cmd>TroubleToggle workspace_diagnostics<cr>", "Toggle Trouble in workspace_diagnostics mode" },
		q = { "<cmd>TroubleToggle quickfix<cr>", "Toggle Trouble in quickfix mode" },
	},

	u = {
		"<cmd>UndotreeToggle<cr>",
		"UndoTree",
	},
}

mappings.leaderx = {
	l = {
		name = "Language",
		a = { "<cmd>Lspsaga range_code_action<cr>", "Code actions" },
	},
}

mappings.g = {
	b = { "<cmd>BufferLinePick<cr>", "Go to a buffer" },
	D = { "<cmd>lua vim.lsp.buf.declaration()<cr>", "Go to declaration" },
	d = { "<cmd>lua vim.lsp.buf.definition()<cr>", "Go to definition" },
	i = { "<cmd>lua vim.lsp.buf.implementation()<cr>", "Go to implementation" },
	r = { "<cmd>Lspsaga lsp_finder<cr>", "Go to references" },
}

mappings.full = {
	["]d"] = { "<cmd>Lspsaga diagnostic_jump_next<cr>", "Go to next diagnostic point" },
	["[d"] = { "<cmd>Lspsaga diagnostic_jump_prev<cr>", "Go to previous diagnostic point" },
	["[["] = { "Go to start of previous function" },
	["[]"] = { "Go to end of previous function" },
	["[c"] = { "Go to start of previous class" },
	["[C"] = { "Go to end of previous class" },
	["]["] = { "Go to start of next function" },
	["]]"] = { "Go to end of next function" },
	["]c"] = { "Go to start of next class" },
	["]C"] = { "Go to end of next class" },
}
-- Pending ====================================================================
-- AerialToggle

return mappings
